﻿using AutoMapper;
using TaskManager.Domain.BusinessObjects;
using TaskManager.Web.ViewModels.Project;

namespace TaskManager.Web.Mappers
{
    /// <summary>
    /// Provides mapping from <see cref="Project"/> to <see cref="ProjectCreateOrEditModel"/>
    /// </summary>
    internal static class ProjectMapper
    {
        /// <summary>
        /// Static constructor that registers mapping
        /// </summary>
        static ProjectMapper()
        {
            Mapper.CreateMap<Project, ProjectCreateOrEditModel>();
            Mapper.CreateMap<ProjectCreateOrEditModel, Project>();
        }

        /// <summary>
        /// Maps <see cref="Project"/> to <see cref="ProjectCreateOrEditModel"/>
        /// </summary>
        /// <param name="project">Project</param>
        /// <param name="model">Model</param>
        public static void Map(Project project, ProjectCreateOrEditModel model)
        {
            Mapper.Map(project, model);
        }

        /// <summary>
        /// Maps <see cref="ProjectCreateOrEditModel"/> to <see cref="Project"/>
        /// </summary>
        /// <param name="model">Model</param>
        /// <param name="project">Project</param>
        public static void Map(ProjectCreateOrEditModel model, Project project)
        {
            Mapper.Map(model, project);
        }
    }
}